use serde::{Deserialize, Serialize};
use validator::Validate;
use wanmesh_common::validator::validate_string_is_not_empty;

#[derive(Serialize, Deserialize, Validate, Debug, Clone)]
pub struct AddParams {
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub te_policy_group_id: String,
    #[validate(custom(function = "validate_string_is_not_empty"))]
    pub name: String,
    pub description: String,
    #[validate(range(min = 1))]
    pub preference: u32,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AddResponseData {
    pub candidate_path_id: String,
}

#[derive(Serialize, Deserialize, Validate, Default, Debug, Clone, Eq, PartialEq)]
pub struct UpdateParams {
    pub name: Option<String>,
    pub description: Option<String>,
    pub preference: Option<u32>,
}

#[derive(Serialize, Deserialize, Validate, Default, Debug, Clone, Eq, PartialEq)]
pub struct Filter {
    pub te_policy_group_id: Option<String>,
    pub name: Option<String>,
}
